oo::class create PopupFontChooserDialog {
    superclass PopupDialog
    variable Path PopUpFlag OKVal CancelVal ifDestroy \
        IfBold IfSlant Font FontFamily

    constructor {args} {
        next {*}$args

        set Font {}
        set IfBold normal
        set IfSlant roman
    }

    method popup {font msg} {
        set Font $font
        set FontFamily [lindex $Font 0]
        if {[llength $Font] >= 3} {
            set IfBold [lindex $Font 2]
        }
        if {[llength $Font] >= 4} {
            set IfSlant [lindex $Font 3]
        }
        next $msg
    }

    method createPopup {msg} {
        next $msg

        ttk::frame $Path.f1
        ttk::label $Path.f1.fm -text family; ttk::combobox $Path.f1.fme -values [lsort [font families]] \
            -textvariable [info object namespace [self object]]::FontFamily
        ttk::label $Path.f1.s  -text size;   ttk::spinbox $Path.f1.se -from 8 -to 30
        ttk::frame $Path.f2
        ttk::checkbutton $Path.f2.bo -text bold -onvalue bold -offvalue normal -variable [info object namespace [self object]]::IfBold
        ttk::checkbutton $Path.f2.sl -text slant -onvalue italic -offvalue roman -variable [info object namespace [self object]]::IfSlant

        $Path.f1.se set [lindex $Font 1]

        grid $Path.f1.fm $Path.f1.fme -sticky news -pady 1
        grid $Path.f1.s $Path.f1.se -sticky news -pady 1
        pack $Path.f1 -side top
        pack $Path.f2.bo $Path.f2.sl -side left -expand 1
        pack $Path.f2 -side top -fill x
    }

    method turnOnFlag {} {
        set Font [list $FontFamily [$Path.f1.se get] $IfBold $IfSlant]
        set PopUpFlag $Font
    }

    method turnOffFlag {} {
        set PopUpFlag {}
    }
}
